package com.qf.api.sys.query;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.api.sys.entity.SysOperationLogEntity;
import com.qf.api.sys.mybatis.page.AbstractQuery;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author: sin
 * @Date: 2025/5/12 21:43
 * @Description:
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class OperationLogQuery extends AbstractQuery<SysOperationLogEntity> {

    private String module;

    private String username;

    private Integer status;

    @Override
    public QueryWrapper<SysOperationLogEntity> addQueryCondition() {
        QueryWrapper<SysOperationLogEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.like(StrUtil.isNotEmpty(module), "request_module", module)
            .like(StrUtil.isNotEmpty(username), "username", username)
            .eq(status != null, "status", status);

        this.timeRangeColumn = "operationTime";
        return queryWrapper;
    }
}
